﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NTmdb.Fakes;

namespace NTmdb.TestProject
{
    /// <summary>
    ///     This is a test class for TmdbDiscoverySortByExtensionTest and is intended
    ///     to contain all TmdbDiscoverySortByExtensionTest Unit Tests
    /// </summary>
    [TestClass]
    public class TmdbDiscoverySortByExtensionTest
    {
        /// <summary>
        ///     A test for ToTmdbParameter
        /// </summary>
        [TestMethod]
        public void ToTmdbParameterTest()
        {
            IApiConfiguration apiConfiguration = new StubIApiConfiguration();
            apiConfiguration.SortByPopularityAscending = Guid.NewGuid().ToString();
            apiConfiguration.SortByPopularityDescending = Guid.NewGuid().ToString();
            apiConfiguration.SortByReleaseDateAscending = Guid.NewGuid().ToString();
            apiConfiguration.SortByReleaseDateDescending = Guid.NewGuid().ToString();
            apiConfiguration.SortByVoteAverageAscending = Guid.NewGuid().ToString();
            apiConfiguration.SortByVoteAverageDescending = Guid.NewGuid().ToString();

            Assert.AreEqual( apiConfiguration.SortByPopularityAscending,
                             TmdbDiscoverySortBy.PopularityAsc.ToTmdbParameter( apiConfiguration ) );

            Assert.AreEqual( apiConfiguration.SortByPopularityDescending,
                             TmdbDiscoverySortBy.PopularityDesc.ToTmdbParameter( apiConfiguration ) );

            Assert.AreEqual( apiConfiguration.SortByReleaseDateAscending,
                             TmdbDiscoverySortBy.ReleaseDateAsc.ToTmdbParameter( apiConfiguration ) );

            Assert.AreEqual( apiConfiguration.SortByReleaseDateDescending,
                             TmdbDiscoverySortBy.ReleaseDateDesc.ToTmdbParameter( apiConfiguration ) );

            Assert.AreEqual( apiConfiguration.SortByVoteAverageAscending,
                             TmdbDiscoverySortBy.VoteAverageAsc.ToTmdbParameter( apiConfiguration ) );

            Assert.AreEqual( apiConfiguration.SortByVoteAverageDescending,
                             TmdbDiscoverySortBy.VoteAverageDesc.ToTmdbParameter( apiConfiguration ) );
        }
    }
}